<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>title</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<script type="text/javascript" language="javascript"
	src="/js/jquery.min.js"></script>
<style type="text/css">
.alert-box {
	display: none;
	position: fixed;
	top: 0px;
	bottom: 0px;
	width: 100%;
	z-index: 99998;
}

.alert-box .mask-bg {
	display: block;
	position: fixed;
	width: 100%;
	height: 100%;
	background-color: #000;
	/* IE9 + etc...modern browsers */
	opacity: .5;
	/* IE 4-9 */
	filter: alpha(opacity = 50);
}

.alert-box .alertbox {
	display: block;
	position: fixed;
	left: 50%;
	top: 50%;
	margin-left: -200px;
	margin-top: -125px;
	width: 400px;
	height: 250px;
	background-color: #f3f3ee;
	z-index: 99999;
}

.alert-box .alertbox .pdbox {
	padding-bottom: 0px;
	text-align: center;
}

.alert-box .alertbox .pdbox img {
	width: 400px;
	height: 250px;
	cursor: pointer;
}

.table-c table {
	min-height: 25px;
	line-height: 25px;
	text-align: center;
	border-right: 1px solid #000;
	border-bottom: 1px solid #000
}

.table-c table th {
	border-left: 1px solid #000;
	border-top: 1px solid #000
}

.table-c table td {
	border-left: 1px solid #000;
	border-top: 1px solid #000
}
</style>
<script type="text/javascript">
	$(document).ready(function() {
		$(".pdbox img").bind("click", function() {
			$("#imgDiv").hide();
		});
	});
	function showImg(id) {
		var path = $("#" + id).val();
		$("#img").attr("src", "/upload/filesshow?path=" + path);
		$("#imgDiv").show();
	}
	function deleteImg(id) {
		if(confirm("确认删除吗？"))
		{
			$.ajax({
				url : "/upload/filesdelete",
				data : {"uuid" : id},
				dataType : "json",
				cache : false,
				async : true,
				success : function(msg) {
					if(msg.success)
					{
						alert("删除成功");
						top.window.location.href = window.location.href;
					}
				}
			});
		}
	}
</script>


</head>

<body>
	<h1>以下资源可供下载</h1>
	<div class="table-c">
		<table cellpadding="0" cellspacing="0" width="100%">
			<tbody>
				<tr>
					<th>名称</th>
					<th>上传日期</th>
					<th>大小</th>
					<th>操作</th>
					<th>描述</th>
				</tr>
				<c:forEach items="${filesList}" var="file">
					<c:url value="/upload/filedown" var="url">
						<c:param name="filepath" value="${file.uploadDire}"></c:param>
					</c:url>
					<tr>
						<td>${file.uFileName}</td>
						<td>${file.uploadDate}</td>
						<td>${file.fileSize}kb</td>
						<td><a href="${url}">下载</a> &nbsp;&nbsp; <a
							href="javascript:void(0);" onclick="showImg('${file.uuid}')">预览</a>
							&nbsp;&nbsp; <a href="javascript:void(0);"
							onclick="deleteImg('${file.uuid}')">删除</a> <input type="hidden"
							id="${file.uuid}" name="${file.uuid}" value="${file.uploadDire}" /></td>
						<td>${file.description}</td>
					</tr>
				</c:forEach>
			</tbody>
		</table>
	</div>
	<div></div>
	<div class="alert-box" style="display: none" id="imgDiv">
		<div class="alertbox">
			<div class="pdbox">
				<img id="img" src="">
			</div>
		</div>
		<div class="mask-bg"></div>
	</div>
</body>
</html>